The Search menu gives you access to basic and extended searches and to automated replacement of extended characters and double-spacing. The Search tab in the Results window displays the results of extended operations.
Selecting text in a document automatically inserts it in the Find what text box. If you select the Options > Settings > Editor > Select nearest word for searches option, the following behaviors are enabled:
This option applies to both basic and extended operations.
You can reuse search strings for both basic and extended searches, but the method for saving the search text differs.
The basic Find and Replace operations are performed on the active document, even if it is an untitled, unsaved document.
![]() |
To search the current document: |
If you highlight text in the editor, it displays in the Find what box. If no text is highlighted, the text string at the cursor position displays. If the cursor is in a blank space, the nearest text string displays.
Press F3 to resume the search from the current cursor position after the search dialog box closes.
![]() |
To replace text in the current document: |
In addition to the Up and Down Direction options, you can restrict the search to part of the document by highlighting a block of text in the editor and selecting Selection.
The last 10 items are saved in the Find what and Replace what drop-down lists.
For more complex operations across multiple documents, use the Extended Find and Extended Replace commands.
The Results window opens to display a list of locations where the search text was found and/or replaced. You can work with these results in several ways:
Note | To prevent slow execution of project link verification and extended search and replace operations caused by parsing large binary files such as exe, pdf, zip, and media file types, a list of excluded file extensions is installed in the Windows Registry LinkVerifyExcludeExts key. |
Use the Search > Replace Extended Characters command to either replace extended characters with character entities, or replace character entities with the equivalent extended characters. This command works only in the current document.
Because of the way different operating systems treat carriage returns, text files saved on UNIX or Macintosh systems might become double-spaced when opened in Studio. Use the Search > Replace Double Spacing with Single Spacing command to collapse double-spaced lines to single-spaced lines in the current document.
HomeSite supports searching with regular expressions to match patterns in character strings in the Extended Find and Replace commands. Regular expressions allow you to specify all the possible variants in a search and to precisely control replacements. Ordinary characters are combined with special characters to define the pattern for the search. The RegExp parser evaluates the selected files and returns each matching pattern.
When you select the Find option, the matching pattern is added to the find list. When you select the Replace option, the replacement text is inserted. When replacing a string, it is just as important to ensure what is not matched as what is. Simple regular expressions can be concatenated into complex search criteria. Note that enabling the Regular expressions option in the Extended dialog boxes disables the Skip tags while searching option.
Note | The rules listed in this section are for creating regular expressions in HomeSite. The rules used by other RegExp parsers might differ. |
The RegExp engine processes the entire document, it does not parse on a line-by-line basis. This affects the way the characters such the asterisk (*), carat (^) and dollar sign ($) should be used.
Because special characters are the operators in regular expressions, in order to represent a special character as an ordinary one, you need to precede it with a backslash. To represent a backslash, for instance, use a double backslash (\\).
This section describes the rules for creating regular expressions. You can use regular expressions in the Search > Extended Find and Replace commands to match complex string patterns.
The following rules govern one-character RegExp that match a single character:
You can specify a character by using one of the POSIX character classes. You enclose the character class name inside two square brackets, as in this Replace example:
"Allaire's Web Site","[[:space:]]","*","ALL")
This code replaces all the spaces with *, producing this string:
Allaire's*Web*Site
The following table shows supported POSIX character classes:
Character Class | Matches |
---|---|
alpha |
Any letter [A-Za-z] |
upper |
Any uppercase letter [A-Z] |
lower |
Any lowercase letter [a-z] |
digit |
Any digit [0-9] |
alnum |
Any alphanumeric character [A-Za-z0-9] |
xdigit |
Any hexadecimal digit [0-9A-Fa-f] |
space |
A tab, new line, vertical tab, form feed, carriage return, or space |
|
Any printable character |
punct |
Any punctuation character |
graph |
Any character defined as a printable character except those defined as part of the space character class |
cntrl |
Any character not part of the character classes [:upper:], [:lower:], [:alpha:], [:digit:], [:punct:], [:graph:], [:print:], [:xdigit:] |
You can use the following rules to build multicharacter regular expressions:
HomeSite supports back referencing, which allows you to match text in previously matched sets of parentheses. You can use a slash followed by a digit n (\n) to refer to the nth parenthesized subexpression.
One example of how you can use back references is searching for doubled words, for example, to find instances of "is is" or "the the" in text. The following example shows the syntax you use for back referencing in regular expressions:
("There is is coffee in the the kitchen", "([A-Za-z]+)[ ]+\1","*","ALL")
This code searches for words that are all letters ([A-Za-z]+) followed by one or more spaces [ ]+ followed by the first matched subexpression in parentheses. The parser detects the two occurrences of is as well as the two occurrences of the and replaces them with an asterisk, resulting in the following text:
There * coffee in * kitchen
You can anchor part of a regular expression to either the beginning or end of the string being searched:
The following examples show some regular expressions and describe what they match
Expression | Description |
---|---|
[\?&]value= |
A URL parameter value in a URL |
[A-Z]:(\\[A-Z0-9_]+)+ |
An uppercase DOS/Windows full path that (a) is not the root of a drive, and (b) has only letters, numbers, and underscores in its text |
[A-Za-z][A-Za-z0-9_]* |
A ColdFusion variable with no qualifier |
([A-Za-z][A-Za-z0-9_]*)(\.[A -Za-z][A-Za-z0-9_]*)? |
A ColdFusion variable with no more than one qualifier, for example, Form.VarName, but not Form.Image.VarName |
(\+|-)?[1-9][0-9]* |
An integer that does not begin with a zero and has an optional sign |
(\+|-)?[1-9][0-9]*(\.[0-9]*) ? |
A real number |
(\+|-)?[1-9]\.[0-9]*E(\+|-)? [0-9]+ |
A real number in engineering notation |
a{2,4} |
Two to four occurrences of "a": aa, aaa, aaaa |
(ba){3,} |
At least three "ba" pairs: bababa, babababa, ... |
An excellent reference on regular expressions is Mastering Regular Expressions by Jeffrey E.F. Friedl, published by O'Reilly & Associates, Inc.